<?php
/* --------------------------------------------------------------
   GMStatusbar.php 2008-08-10 gambio
   Gambio OHG
   http://www.gambio.de
   Copyright (c) 2008 Gambio OHG
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/
?><?php



	

	class GMStatusbar {

		

		function GMStatusbar() {

			return;

		}

		

		// category statusbar text

		function get_cat_statusbar($cat_id, $languages_id) {

			$gm_statusbar = '';

			$gm_query = xtc_db_query("SELECT

																	gm_statusbar

																FROM

																	categories_description

																WHERE

																	categories_id = '" . (int)$cat_id . "'

																	AND language_id = '" . (int)$languages_id . "'"); 

			if(xtc_db_num_rows($gm_query) == 1){

				$gm_row = xtc_db_fetch_array($gm_query);

				$gm_statusbar = $gm_row['gm_statusbar'];

			}

			return $gm_statusbar;

		}

		

		// product statusbar text

		function get_product_statusbar($products_id, $languages_id) {

			$gm_statusbar = '';

			$gm_query = xtc_db_query("SELECT

																	gm_statusbar

																FROM

																	products_description

																WHERE

																	products_id = '" . (int)$products_id . "'

																	AND language_id = '" . (int)$languages_id . "'"); 

			if(xtc_db_num_rows($gm_query) == 1){

				$gm_row = xtc_db_fetch_array($gm_query);

				$gm_statusbar = $gm_row['gm_statusbar'];

			}

			return $gm_statusbar;

		}

		

		function get_statusbar_text($cat_id, $products_id, $languages_id){

			if(!empty($products_id)){

				$gm_statusbar_text = $this->get_product_statusbar($products_id, $languages_id);

				if(empty($gm_statusbar_text)){

					$gm_statusbar_text = $this->get_cat_statusbar($cat_id, $languages_id);

					if(empty($gm_statusbar_text)){

						$gm_statusbar_text = gm_get_content('GM_STATUSBAR_TEXT', $languages_id);

					}

				}

			}

			elseif(!empty($cat_id)){

				$gm_statusbar_text = $this->get_cat_statusbar($cat_id, $languages_id);

				if(empty($gm_statusbar_text)){

					$gm_statusbar_text = gm_get_content('GM_STATUSBAR_TEXT', $languages_id);

				}

			}

			else $gm_statusbar_text = gm_get_content('GM_STATUSBAR_TEXT', $languages_id);

			

			return $gm_statusbar_text;

		}

	}

?>